import moment from 'moment-timezone'
// 日期根据时区格式化组件
const timezone = moment.tz.guess()
const TZ = function (date) {
  if (date === '0001-01-01T00:00:00') return '1901-01-01 00:00:00'
  const timeTZ = moment(new Date(date)).tz(timezone)
  const time = timeTZ.format('YYYY-MM-DD kk:mm:ss').replace(/([ ][24]+)/g, ' 00')
  return time
}
// .replace(/([ ][0001-01-01T00:00:00]+)/g, ' 1901-01-01 00:00:00')
export default { TZ }
